{% extends 'layout.html' %}

{% block content %}

<div class="blog-post">
    <h2 class="blog-post-title"> {{content.title}} </h2>
    <p class="blog-post-meta">
        {{content.addTime|date('Y年m月d日 H:i:s', -8 * 60)}}
        作者： {{content.user.username}}
        阅读：{{content.views}}
        评论：10
    </p>
    <p> {{content.description}} </p>
    <hr>
    <p> {{content.content}} </p>
</div><!-- /.blog-post -->
<h1 class="page-header">评论</h1>
{% if userInfo._id %}
<form>
    <div class="form-group">
        <textarea class="form-control" name="" id="messageContent" cols="30" rows="10"></textarea>
    </div>
    <input type="hidden" name="" id="contentid" value="{{content._id.toString()}}">
    <button id="btn" type="submit" class="btn btn-default">Submit</button>
</form>
{% else %}
<div class="alert alert-danger" role="alert">你还没有登录，请登录！</div>
{% endif %}
<div id="messageList">
    {% for con in content.comments %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{{con.username}}
                <span class="text-info pull-right">{{con.postTime|date('Y年m月d日 H:i:s', -8 * 60)}}</span>
            </h3>
        </div>
        <div class="panel-body">
            {{con.content}}
        </div>
    </div>
    {% endfor %}
</div>

<script src="/public/js/comment.js"></script>
{% endblock %}